const joi = require("joi");
//注册账号
const username = joi.string().alphanum().min(1).required().error(new Error('用户名不符合规范'));
const password1 = joi.string().pattern(/^[\S]{6,20}$/).required().error(new Error('密码不符合规范'));
const realName = joi.string().min(1).required().error(new Error('姓名不符合规范'));
const grade = joi.string().required().error(new Error('年级专业班级不符合规范'));
const roles = joi.string().required().error(new Error('角色不符合规范'));
const id = joi.string().required().error(new Error('id不存在'));
const password2 = joi.string().pattern(/^[\S]{6,20}$/).error(new Error('密码不符合规范'))
exports.register = {
  body: {
    username,
    password:password1,
    realName,
    grade,
    roles,
  },
};

//登录
exports.login = {
    body:{
        username,
        password:password1
    }
}
exports.updateUserInfo = {
  body:{
    username,
    password:password2,
    realName,
    grade,
    roles,
    id
  }
}
exports.updatePassword= {
  body:{
    id,
    oldPassword:password1,
    newPassword:password1,
  }
}